package com.design.movieticket.controller;

import com.design.movieticket.common.base.constant.Result;
import com.design.movieticket.common.base.constant.ResultStatus;
import com.design.movieticket.entity.Cinema;
import com.design.movieticket.entity.Collect;
import com.design.movieticket.service.CollectService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.rmi.MarshalledObject;

@Slf4j
@Api(tags = "收藏模块")
@RestController
@RequestMapping("/collect")
public class CollectController {
    @Resource
    private CollectService collectService;

    /** 收藏与否 */
    @PostMapping("/collectOrNot")
    public Result collectOrNot(@RequestBody Collect collect) {
        return new Result(collectService.collectOrNot(collect),ResultStatus.REQUEST_SUCCESS.getMsg(),ResultStatus.REQUEST_SUCCESS.getCode());
    }

    /** 收藏 */
    @PostMapping("/collectMovie")
    public Result collectMovie(@RequestBody Collect collect) {
        collectService.collectMovie(collect);
        return new Result(ResultStatus.REQUEST_SUCCESS.getMsg(),ResultStatus.REQUEST_SUCCESS.getCode());
    }

    /** 查看收藏 */
    @GetMapping("/seeCollectMovieList/{userId}")
    public Result seeCollectMovieList(@PathVariable Long userId) {
        return new Result(collectService.seeCollectMovieList(userId),ResultStatus.REQUEST_SUCCESS.getMsg(),ResultStatus.REQUEST_SUCCESS.getCode());
    }
}
